]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyring-prompt: relax NULL check in remove_mnemonics()
authorCosimo Cecchi <cosimo@endlessm.com>
Sun, 26 May 2019 17:16:03 +0000 (10:16 -0700)
committerCosimo Cecchi <cosimo@endlessm.com>
Mon, 27 May 2019 15:36:11 +0000 (08:36 -0700)
Instead of considering a GValue containing a NULL string to be a
programmer error, simply return NULL.
remove_mnemonics() is in fact called on the value of the
"choice-label" property as well, which has NULL as its default
value.

This prevents triggering the following gnome-shell warning:

gnome-shell[1082]: remove_mnemonics: assertion 'label != NULL' failed

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/555

src/shell-keyring-prompt.c

index 1a8cb3ba0af72aa5122e815b0b6dedf5e011d001..092c19ac5c9758f237a8bee571850420f3a6f831 100644 (file)
@@ -115,7 +115,8 @@ remove_mnemonics (const GValue *value)
   g_return_val_if_fail (G_VALUE_HOLDS_STRING (value), NULL);
 
   label = g_value_get_string (value);
-  g_return_val_if_fail (label != NULL, NULL);
+  if (!label)
+    return NULL;
 
   /* Stripped label will have the original label length at most */
   stripped_label = temp = g_new (gchar, strlen(label) + 1);